Skip to content

Conversation

@sycai
Copy link
Contributor

@sycai sycai commented Jan 17, 2026

Next step is to add the encoded usage to the job_config.label before SQL dispatch.

Related bug: b/406578908

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jan 17, 2026
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Jan 17, 2026
@sycai sycai requested review from chelsea-lin and tswast January 20, 2026 18:26
@sycai sycai marked this pull request as ready for review January 20, 2026 18:26
@sycai sycai requested review from a team as code owners January 20, 2026 18:26
curr_result = curr_result | _encode_type_refs_from_expr(
assignment[0], node.child
)
elif isinstance(node, nodes.SelectionNode):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These node types are missed here: ReadLocalNode, ReadTableNode, ConcatNode, ExplodeNode, RandomSampleNode, FromRangeNode. You can find a full list of nodes in the compiler: https://github.com/googleapis/python-bigquery-dataframes/blob/main/bigframes/core/compile/ibis_compiler/ibis_compiler.py

Copy link
Contributor Author

@sycai sycai Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think only ExplodeNode applies here because it has deref field. There are no column-specific operations for all the other nodes, so I will leave them out.

Added the tracking of columns for ExplodeNode in the this change.

curr_result = curr_result | _encode_type_refs_from_expr(
col_def.expression, node.child
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can explicitly handle all of existing nodes, we should throw an error for unknown new nodes. If we want to add new BF nodes, this can help us remember handling logs for new BF nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added explicit mentioning of nodes to be skipped, but I think it's risky to raise errors in the logging code path: the user might get blocked and confused by logging errors that has nothing to do with their business code, which led to bad experiences.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, the BF node types are limited and all are known to us so customers won't see the errors. It owuld be untracked if logs are missed quietly. That's my thoughts but it's okay to leave it for your call. Thanks!

def _encode_type_refs_from_expr(
expr: expression.Expression, child_node: bigframe_node.BigFrameNode
) -> int:
# TODO(b/409387790): Remove this branch once SQLGlot compiler fully replaces Ibis compiler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this throw any errors if we forget to remove this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the SQLGlot migration is complete, this branch will become a dead code. I don't think there's a need to raise an error because it does not affect any functionalities.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Thanks!

@sycai sycai requested a review from chelsea-lin January 21, 2026 21:52
@sycai sycai merged commit e90e1d8 into main Jan 22, 2026
23 of 26 checks passed
@sycai sycai deleted the sycai_type_usage branch January 22, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants